package com.yj.rselasticsearch.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yj.common.core.domain.AjaxResult;
import com.yj.rselasticsearch.domain.dto.RetrievalRecordDto;
import com.yj.rselasticsearch.domain.vo.RetrievalRecordVo;
import com.yj.rselasticsearch.service.RetrievalRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 检索信息记录表控制层
 *
 * @author luoY
 */
@RestController
@Slf4j
@Api("检索信息记录表控制层")
@RequestMapping("/retrievalRecord")
public class RetrievalRecordController {

    @Resource
    private RetrievalRecordService retrievalRecordService;

    /**
     * 分页统计查询检索信息
     *
     * @param record
     * @return
     */
    @ApiOperation("分页统计查询检索信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex", value = "页码", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "keyword", value = "关键词", dataType = "String", dataTypeClass = String.class)
    })
    @PostMapping("getRetrievalRecordList")
    public AjaxResult getRetrievalRecordList(@RequestBody RetrievalRecordDto record) {
        IPage<RetrievalRecordVo> retrievalRecordIPage = retrievalRecordService.getRetrievalRecordList(record);
        return AjaxResult.success(retrievalRecordIPage);
    }
}
